﻿<%@ Page Title="" Language="C#" MasterPageFile="~/web/common/admin_common.Master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="shop.web.view_admin.order.List" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>订单列表</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="layui-form">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">选择框</label>
            <div class="layui-inline">
                <select lay-verify="required" name="catagoryId">
                    <option></option>
                    <option value="1">珠宝</option>
                    <option value="2">生日礼物</option>
                    <option value="3">家具装饰</option>
                    <option value="4">房屋装饰</option>
                </select>
            </div>
            <input type="button" name="name" value="查找" class="layui-btn" />
        </div>

    </div>

    <table class="layui-table" lay-skin="row line">
        <tr class="tr1">
            <td>编号</td>
            <td>用户姓名</td>
            <td>商品名称</td>
            <td>商品状态</td>
            <td>创建时间</td>
            <td colspan="3">操作</td>
        </tr>
        <%foreach (var order in orderList)
            { %>
        <tr class="tr2">
            <td><%=order.Id %></td>
            <td><%=order.User.Name %></td>
            <td><%=order.Goods.Name%></td>
            <td><%=order.PayStatus %></td>
            <td><%=order.OrderTime%></td>

            <td><a href="/web/view_admin/order/detail.aspx?id=<%=order.Id %>" class="layui-btn  layui-btn-xs">查看</a></td>
            <td><a href="/web/view_admin/order/edit.aspx?id=<%=order.Id %>" class="layui-btn  layui-btn-xs">编辑</a></td>
            <td><a href="javascript:deleteUser( <%=order.Id %> )" class="layui-btn layui-btn-danger layui-btn-xs">删除</a></td>
        </tr>
        <%} %>
    </table>
    <script>
        function deleteUser(id) {
            var index = layer.confirm('确定删除该订单？', function (index) {
                $.post("/handler/OrderHandler.ashx?method=delete&id=" + id, function (data) {
                    var obj = JSON.parse(data);
                    console.log(data)
                    if (obj.ErrorCode === 0) {
                        //成功
                        layer.msg(obj.Message, { icon: 6,time : 2000 }, function () {
                             window.location.reload();
                        });                      
                    } else {
                        layer.msg(obj.Message, { icon: 2 })
                    }
                })

                layer.close(index);
            });

        }
    </script>
</asp:Content>

